package com.hqd.ch03.v50.web.context.support;

import com.hqd.ch03.v50.core.env.EnumerablePropertySource;
import com.hqd.ch03.v50.utils.StringUtils;

import javax.servlet.ServletContext;

public class ServletContextPropertySource extends EnumerablePropertySource<ServletContext> {

    public ServletContextPropertySource(String name, ServletContext servletContext) {
        super(name, servletContext);
    }

    @Override
    public String[] getPropertyNames() {
        return StringUtils.toStringArray(this.source.getInitParameterNames());
    }

    @Override
    public String getProperty(String name) {
        return this.source.getInitParameter(name);
    }

}
